﻿<@override name="head">	
<title>编辑账号权限</title>
<script type="text/javascript" src="${ctx}/assets/js/common/validate.js"></script>
<script type="text/javascript" src="${ctx}/assets/js/back/resources.js"></script>
<script type="text/javascript" src="${ctx}/assets/js/back/account.js"></script>

</@override>	
<@override name="body">
<div id=content_bg>
<#include "/main/home/common.ftl"/>
	<div id= "pagecontent">
		<div id="content">
	   		<div id="navDiv">
				<ul id="navDiv_ul">
					<li><i class="icon-home"></i></li>
					<li><a href="${ctx}/back/main/dashboard">首页</a></li>
					<li><i class="icon-angle-right"></i></li>
					<li><a href="${ctx}/back/main/account/list">账号权限管理</a></li>
					<li><i class="icon-angle-right"></i></li>
					<li class="navDiv_currentLi">编辑账号权限</li>
				</ul>  
	 		</div>
	 		<form id="validateForm" action="${ctx}/back/main/account/save" method="post">
	 			
		 			<input type="hidden" name="accountId" id="accountId" value=${accountAuthority.id!}>
		 			
					<div class="input-group">
						<label class="input-label"><span class="lbl-yes">*</span>账号名称：</label>
						<input class="input-text" name="name" tabindex="1" disabled="disabled" value=${accountAuthority.account!}><span class="spanVaildate"></span>
					</div>
					<div class="input-group">
						<label class="input-label"><span class="lbl-yes">*</span>所属系统：</label>
						<#if accountAuthority.sysType==1>
							<input class="input-text" name="resKey" tabindex="1" disabled="disabled" value="后台管理平台"><span class="spanVaildate"></span>
						<#elseif accountAuthority.sysType==2>	
							<input class="input-text" name="resKey" tabindex="1" disabled="disabled" value="媒体方平台"><span class="spanVaildate"></span>
						<#else>
							<input class="input-text" name="resKey" tabindex="1" disabled="disabled" value="需求方平台"><span class="spanVaildate"></span>
						</#if>
					</div>
					
					<div class="input-group">
						<label class="input-label"><span class="lbl-yes">*</span>所属角色：</label>
						<#if allRoles ??>
						<#list allRoles as role>
							<#if "${role.id!}"=="${accountAuthority.roleId!}">
								<label for=${role.id!}>${role.name!}</label><input type="radio" checked="checked" id=${role.id!} name="roleId" value=${role.id!}>
								&nbsp;&nbsp;&nbsp;&nbsp;
							<#else>
								<label for=${role.id!}>${role.name!}</label><input type="radio" id=${role.id!} name="roleId" value=${role.id!}>
								&nbsp;&nbsp;&nbsp;&nbsp;
							</#if>
						</#list>
						</#if>
						<#if "${accountAuthority.roleId!}"=="">
							<label for="norole">无角色</label><input type="radio" checked="checked" id="" name="roleId" value="">
									&nbsp;&nbsp;&nbsp;&nbsp;
						<#else>
							<label for="norole">无角色</label><input type="radio" id="" name="roleId" value="">
									&nbsp;&nbsp;&nbsp;&nbsp;
						</#if>
					</div>
					
				<div class="input-group">
					<label class="input-label"><span class="lbl-yes">*</span>所有权限：</label>
					<table border="1" class="permissionTable">
 					<thead>
				        <tr class="theadTr">
				        	<th class="theadTh" style="width:20%;">目录</th>
							<th class="theadTh" style="width:80%;"><span>菜单</span><span class="buttonTh">按钮</span></th>
				        </tr>
				    </thead>
				    <tbody>
				    	<#if allResources ??>
		                <#list allResources as resources>
				        <tr id="tbodyTr">
							<td class="tbodyTd">
								<div class="rootResource">
									<input type="checkbox" name="powers" class="show_check root${resources.id!} self${resources.id!}" id="root_${resources.id!}" name="${resources.resKey!}" value="${resources.id!}"/>
									<label class="checkbox-label" for="${resources.resKey!}_${resources.id!}">${resources.name!}</label>
								</div>
							</td>
							<td class="tbodyTd">
							<div class="menu">
							<#if resources.children ??>
		                	<#list resources.children as menu>
								<div class="menu-item">
									<div class="menu-checkbox">
										<input type="checkbox" name="powers" class="show_check root${resources.id!} self${menu.id!}" id="menu_${menu.id!}_${menu.parentId!}" name="${menu.resKey!}" value="${menu.id!}" parentId="${menu.parentId!}"/>
										<label class="checkbox-label" for="${menu.resKey!}_${menu.id!}">${menu.name!}</label>
									</div>
									<div class="menu-button">
									<#if menu.children ??>
		                			<#list menu.children as button>
										<div class="button-checkbox">
											<input type="checkbox" name="powers" class="show_check root${resources.id!} menu${menu.id!} self${button.id!}" id="button_${button.id!}_${button.parentId!}" name="${button.resKey!}" value="${button.id!}" parentId="${button.parentId!}"/>
											<label class="checkbox-label" for="${button.resKey!}_${button.id!}">${button.name!}</label>
										</div>
									</#list>
									</#if>
									</div>
								</div>
							</#list>
							</#if>
							</div>
							</td>
				        </tr>
				     	</#list>
						</#if> 
					 </tbody>  
 				</table>
				</div>
				
				<div id="footBtn">
					<button class="btn-save" type="submit">保存</button>
					<button class="btn-cancel" id="btn-cancel-authority" type="button">取消</button>
				</div>
			</form>
		</div>
    </div>
</div>
</@override>
<@extends name="/common/simple.ftl"/>